<!DOCTYPE html>
<html>
<head>
<div th:replace="common/common_resource :: common_css"></div>
<title th:text="${application.shop_name} +' | 用户会员'"></title>
</head>
<body class="hold-transition skin-blue sidebar-mini">
	<div class="wrapper">
		<div th:replace="common/common_h5 :: loginAndLogout"></div>
		<div th:replace="common/common_h5 :: upload_image"></div>
		<div th:replace="common/common_h5 :: left_menu"></div>
		<div class="content-wrapper">
			<section class="content">
				<div class="row">
					<div class="col-xs-12">
						<div class="box">
							<div class="box-header">
								<div class="row">
									<div class="col-xs-4">
										<span>
											<button type="button" name="cleanAll" id="add_dep" class="btn  btn-warning " style="margin-bottom: 10px;" data-toggle="modal" data-target="#userrank_add_and_update">
												<i class="fa fa-plus">添加用户会员</i>
											</button>
										</span>
										<div class="modal fade " id="userrank_add_and_update" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
											<div class="modal-dialog">
												<div class="modal-content">
													<div class="modal-header bg-blue">
														<button type="button" name="cleanAll" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
														<h4 class="modal-title" id="myModalLabel">添加/修改用户会员(<font color="red">&nbsp;&nbsp;*</font>为必填项)</h4>
													</div>
													<div class="modal-body">
														<form role="form" id="formUserRank" th:action="${#httpServletRequest.getContextPath()}+'/TblWxUserrank/insertAndUpdate'" method="post">
															<input type="hidden" name="menuUuid" th:value="${menuUuid!=null?menuUuid:'120'}">
															<div class="box-body">
																<div class="form-group">
																	<label for="rankName">用户会员名称<font color="red">&nbsp;&nbsp;*</font></label>
																	<input type="hidden"name="rankId" id="rankId" th:value="${dataBean!=null? dataBean.rankId:''}" />
																	<input type="text" name="rankName" class="form-control" id="rankName" placeholder="用户会员名称" th:value="${dataBean!=null? dataBean.rankName:''}" />
																</div>
																<div class="form-group">
																	<label for="rankCode">用户会员code</label>
																	<input type="text" name="rankCode" class="form-control" id="rankCode" placeholder="用户会员code"  th:value="${dataBean!=null? dataBean.rankCode:''}"/>
																</div>
																<div class="form-group">
																	<label for="rankAmtNum">用户总消费（<i class="fa fa-fw fa-cny"></i>）<font color="red">&nbsp;&nbsp;*</font></label>
                													<input type="NUMBER" name="rankAmtNum" class="form-control" id="rankAmtNum" placeholder="请输入金额" th:value="${dataBean!=null? dataBean.rankAmtNum:''}"/>
              													</div>
																<div class="form-group">
																	<label for="rankIstype">用户会员是否打折<font color="red">&nbsp;&nbsp;*</font></label>
																	<select class="form-control" id="rankIstype" name="rankIstype">
													                    <option value="0" th:selected="(${dataBean!=null? dataBean.rankIstype:''} == 0)" >不参与任何折扣</option>
													                    <option value="1" th:selected="(${dataBean!=null? dataBean.rankIstype:''} == 1)">参与全店打折</option>
													                    <option value="2" th:selected="(${dataBean!=null? dataBean.rankIstype:''} == 2)">参与买满立减</option>
													                 </select>
																</div>
																<div th:class="${(dataBean!=null && dataBean.rankIstype==1)?'form-group show':'form-group hidden'}"  id="rankDiscountDiv">
																	<label for="rankDiscount">会员打折率（eg:输入9.9为9.9折）<font color="red">&nbsp;&nbsp;*</font></label>
																   	<div class="row">
																   		<div class="col-xs-12 text-left">
																			<input type="NUMBER" name="rankDiscount" th:value="${dataBean!=null? dataBean.rankDiscount:''}" class="form-control" id="rankDiscount" placeholder="会员打折率(%)"/>
																  		</div>
																  	</div>
																</div>
																<div class="form-group hidden" id="rankBuyfullIdDiv" th:if="${buyfullTempList!=null && buyfullTempList.size()>0}">
																	<label for="rankBuyfullId">买满立减模板<font color="red">&nbsp;&nbsp;*</font></label>
																	<div class="row">
																		<div class="col-xs-12 text-left">
																			<select class="form-control" id="rankBuyfullId" name="rankBuyfullId">
															                    <option th:value="${buyfullTemp!=null}?${buyfullTemp.buyfullTempId}:''" th:each="buyfullTemp,itemStat:${buyfullTempList}" th:text="${buyfullTemp.buyfullTempName}"></option>
															                 </select>
														                 </div>
													                 </div>
																</div>
																<div th:class="${(dataBean!=null && dataBean.rankIstype==1)?'form-group show':'form-group hidden'}" id="startAndEnd">
																	<label for="rankIstype">打折时间<font color="red">&nbsp;&nbsp;*</font></label>
																	<div class="row">
																		<div class="col-xs-6 text-left">
																			<div class="input-group date">
																			<div class="input-group-addon">
																				<i class="fa fa-calendar"></i>
																			</div>
																			<input class="form-control pull-right datepicker" th:value="${dataBean!=null? dataBean.rankDiscntStatimeView:''}"  id="rankDiscntStatimeView" name="rankDiscntStatimeView" type="text" placeholder="开始时间">
																		</div>
																		</div>
																		<div class="col-xs-6 text-left">
																			<div class="input-group date">
																				<div class="input-group-addon">
																					<i class="fa fa-calendar"></i>
																				</div>
																				<input class="form-control pull-right datepicker" th:value="${dataBean!=null? dataBean.rankDiscntEndtimeView:''}"  id="rankDiscntEndtimeView" name="rankDiscntEndtimeView" type="text" placeholder="结束时间">
																			</div>
																		</div>
																	</div>
																</div>
																<div class="form-group hidden" th:if="${buyfullTempList==null || buyfullTempList.size()==0}" id="rankBuyfullIdDiv" name="addbuyfulls">
																		<div class="row">
																			<div class="col-xs-8 text-right">
																			<font color="red">亲:您还没有添加买满立减模板哦！</font>
																			</div>
																			<div class="col-xs-4 text-left">
																				<a th:href="${#httpServletRequest.getContextPath()}+'/TblWxBuyfullTemplate/list?menuUuid=420'" class="btn btn-block btn-warning">立即添加</a>
																			</div>
																		</div>
																</div>
																<div class="modal-footer">
																	<div class="row">
																		<div class="col-xs-6 text-center">
																			<button type="reset" class="btn btn-warning" name="cleanAll">清&nbsp;&nbsp;&nbsp;&nbsp;除</button>
																		</div>
																		<div class="col-xs-6 text-center">
																			<button type="submit" id="submitBuyFull" class="btn btn-primary">提&nbsp;&nbsp;&nbsp;&nbsp;交</button>
																		</div>
																	</div>
																</div>
															</div>
															</form>
														</div>
													</div>
												</div>
											</div>
										</div>
										<div class="col-xs-4">
											<h3 class="box-title">用户会员列表</h3>
										</div>
										<div class="col-xs-4"></div>
									</div>
								</div>
							</div>
							<div class="box-body table-responsive">
								
							<div class="row" >
							<div class="col-md-12 userrankname" th:if="${list==null || list.size()==0}">
								 没有找到任何会员名称信息，请添加。
							</div>
						        <div class="col-md-4" th:each="data,iterStat:${list}">
						          <div class="nav-tabs-custom">
						            <ul class="nav nav-tabs">
						              <li class="active"><a href="#tab_1" data-toggle="tab" aria-expanded="true">会员信息</a></li>
						              <li class="dropdown pull-right">
						                <a class="dropdown-toggle" data-toggle="dropdown" href="#">
						                 <i class="fa fa-gear"></i>
						                </a>
						                <ul class="dropdown-menu">
						                   <li role="presentation">
						                   		<a role="menuitem" tabindex="-1" href="javascript:void(0);" th:id="${data.rankId}" name="show"><i class="fa fa-fw fa-file-text-o"></i>修改</a></li>
						                   <li role="presentation" class="divider"></li>
						                   <li role="presentation">
						                   		<a role="menuitem" tabindex="-1" href="javascript:void(0);"  th:id="${data.rankId}" data-toggle="tooltip" data-placement="top" data-original-title="删除后将无法恢复" class="example5-3-2"><i class="fa fa-fw fa-trash"></i>废除</a>
						                   </li>
						                </ul>
						              </li>
						            </ul>
						            <div class="tab-content">
						              <div class="tab-pane active" id="tab_1">
						                <div class="row">
						                	<div class="col-xs-6 text-left">会员名称：<b th:text="${data.rankName}"></b></div>
						                 	<div class="col-xs-6 text-left">会员code：<b th:text="${data.rankCode}"></b></div>
						                </div>
						                <label></label>
						                <div class="row">
						                	<div class="col-xs-6 text-left">消费金额：<b th:text="'￥'+${data.rankAmtNum}"></b></div>
						                 	<div class="col-xs-6 text-left">是否参与优惠：<b th:if="${data.rankIstype!=0}">参与</b><b th:if="${data.rankIstype==0}">不参与</b></div>
						                </div>
						                <label></label>
						                <div class="row">
						                 	<div class="col-xs-12 text-left" th:if="${data.rankIstype==1}" >优惠时间段：
						                 		<b th:text="${data.rankDiscntStatimeView}+'-'+${data.rankDiscntEndtimeView}"></b><font color="red" th:if="${data.isExceed==-1}">（优惠时间已过）</font>
						                 	</div>
						                 	<div class="col-xs-12 text-left" th:if="${data.rankIstype==2}">优惠时间段：
						                 		<b  th:text="${data.buyFullTemp!=null}? ${data.buyFullTemp.buyfullTempStarttimeView}+'-'+${data.buyFullTemp.buyfullTempEndtimeView} :''"></b>
						                 		<font color="red" th:if="${data.buyFullTemp!=null && data.buyFullTemp.isExceed==-1}">（优惠时间已过）</font>
						                 	</div>
						                 	<div class="col-xs-12 text-left" th:if="${data.rankIstype==0}">优惠时间段：
						                 		<b></b>
						                 	</div>
						                </div>
						                <hr style="filter: alpha(opacity=100,finishopacity=0,style=2)" width="100%" color="#6f5499" size="3" />
						                <div class="row">
						                	<div class="col-xs-12 text-left" th:if="${data.rankIstype==1}" >会员参与优惠内容：<b>全店折扣</b></div>
						                	<div class="col-xs-12 text-left" th:if="${data.rankIstype==2}" >会员参与优惠内容：<b th:text="${data.buyFullTemp!=null}?${data.buyFullTemp.buyfullTempName}:''"></b></div>
						                	<div class="col-xs-12 text-left" th:if="${data.rankIstype==0}" >会员参与优惠内容：<b></b></div>
						                </div>
						                <label></label>
						                <p th:if="${data.rankIstype==1}">优惠详情：<code th:text="'全店折扣价'+${data.rankDiscount}+'折'"></code>&nbsp;&nbsp;</p>
						                <p th:if="${data.rankIstype==2 && data.buyFullTemp!=null && data.buyFullTemp.buyFullList!=null}">
						                		优惠详情：<code th:each="buyfull,iterStat:${data.buyFullTemp!=null}? ${data.buyFullTemp.buyFullList}:''" th:if="${buyfull!=null}" th:text="'满'+${buyfull.buyfullAmt}+'立减'+${buyfull.buyfullSubtAmt}">
						                		</code>&nbsp;&nbsp;&nbsp;</p>
						                <p th:if="${data.rankIstype==0}">优惠详情：------</p>  	
						                 <p></p>
						              </div>
						            </div>
						          </div>
						        </div>
						      </div>
							</div>
						</div>
					</div>
				</div>
			</section>
		</div>
		<div th:replace="common/common_h5 :: down_foot"></div>
		<div th:replace="common/common_h5 :: down_sidebar"></div>
		<div th:replace="common/common_h5 :: error_message"></div>
		<div class="control-sidebar-bg"></div>
		<div th:replace="common/common_resource :: common_js"></div>
		<script th:src="@{/admin_js/basics/process/tblwxuserrank_list.js}"></script>
</body>
</html>